package com.app.teaware.set;

import android.content.ContentResolver;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.widget.TextView;

import com.app.teaware.R;
import com.app.teaware.basis.BasisActivity;
import com.app.teaware.bean.UpdateBean;
import com.app.teaware.other.PhotoScanDialog;

import butterknife.BindView;
import butterknife.OnClick;
import my.LogUtil;
import my.SystemParamsUtils;

/***
 * 关于我们
 * **/
public class AboutUsActivity extends BasisActivity {


    @BindView(R.id.text_version_name)
    TextView text_version_name;

    @Override
    public void initViews() {
        // TODO Auto-generated method stub
        super.initViews();
        setContentView(R.layout.setting_aboutus_activity);
        setTitle(R.string.app_aboutus);
        setTitleLeftButton(null);
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.initData(savedInstanceState);

        text_version_name.setText("v" + SystemParamsUtils.getAppVersonName(mContext));

    }


    @OnClick(R.id.view_qrcode)
    void qrcode() {
        Resources r = mContext.getResources();
        Uri uri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://"
                + r.getResourcePackageName(R.drawable.qr_code) + "/"
                + r.getResourceTypeName(R.drawable.qr_code) + "/"
                + r.getResourceEntryName(R.drawable.qr_code));

        LogUtil.i("--uri---"+uri.toString());
        PhotoScanDialog.toImgScanDialog(mContext, uri.toString());
    }

    @OnClick(R.id.view_update)
    void update() {
        UpdateBean.check(mContext,true);
//        DialogUtils.DialogOkMsg(mContext,"当前是最新版本");
//        showToast("当前是最新版本");
//        UpdateUtil.checkUpdate(mContext, true);

//        ProjectFileData projectFileData = new ProjectFileData();
//        projectFileData.setFilePath("http://cn.createpdfonline.org/pdffiles/asdfsaf(20200724114919).pdf");
//        projectFileData.setFileName(FileUtils.getFileNameFromUrlSimple("http://cn.createpdfonline.org/pdffiles/asdfsaf(20200724114919).pdf"));
//        projectFileData.openOnline(mContext);
//        PdfScanActivity.toPdfScanActivity(mContext,"http://cn.createpdfonline.org/pdffiles/asdfsaf(20200724114919).pdf","");
    }

}
